#include "mythread.h"
#include <QDebug>
#include <QThread>

#include <QMessageBox>

myThread::myThread(QObject *parent) : QObject(parent)
{

}

void myThread::myTimeout()
{
    qDebug() << "func:" << __FUNCTION__;
    while(!isStop)
    {
        //每隔1秒发信号
        QThread::sleep(1);
        emit mySignal();
         //QMessageBox::aboutQt(NULL); 线程处理函数内部不允许处理图形界面
        qDebug() << "subThreadId is" << QThread::currentThreadId();
        if(isStop){
            break;
        }
    }
}

void myThread::setFlag(bool flag)
{
    isStop = flag;
}
